home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / telecomm / sticpsrc.lzh / SOURCE.ARC / UDPCMD.C < prev    next >
C/C++ Source or Header  |  1989-07-20  |  935b  |  41 lines

  1. /* UDP-related user commands */
  2. #include <stdio.h>
  3. #include "global.h"
  4. #include "mbuf.h"
  5. #include "netuser.h"
  6. #include "udp.h"
  7. #include "internet.h"
  8. #include "cmdparse.h"
  9.  
  10. int doudpstat();
  11. struct cmds udpcmds[] = {
  12.     "status",    doudpstat,    0,    NULLCHAR,    NULLCHAR,
  13.     NULLCHAR,    NULLFP,        0,
  14.         "?subcommands",    NULLCHAR,
  15. };
  16.  
  17. doudp(argc,argv)
  18. int argc;
  19. char *argv[];
  20. {
  21.     return subcmd(udpcmds,argc,argv);
  22. }
  23. /* Dump UDP statistics and control blocks */
  24. doudpstat()
  25. {
  26.     extern struct udp_stat udp_stat;
  27.     register struct udp_cb *udp;
  28.     register int i;
  29.  
  30.     printf("sent %u rcvd %u bdcsts %u cksum err %u unknown socket %u\n",
  31.     udp_stat.sent,udp_stat.rcvd,udp_stat.bdcsts,udp_stat.cksum,udp_stat.unknown);
  32.     printf("    &UCB Rcv-Q  Local socket\n");
  33.     for(i=0;i<NUDP;i++){
  34.         for(udp = udps[i];udp != NULLUDP; udp = udp->next){
  35.             printf("%8lx%6u  %s\n",ptr2long(udp),udp->rcvcnt,
  36.              psocket(&udp->socket));
  37.         }
  38.     }
  39. }
  40.  
  41.